how to use proxy on centos7

  1. system

    edit /etc/profile, like this:

    vi /etc/profile
    all_proxy=socks5://username:password@ip:port
    no_proxy=127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
    export all_proxy no_proxy
    source /etc/profile
    
  2. docker

    edit /usr/lib/systemd/system/docker.service, like this:

    vi /usr/lib/systemd/system/docker.service
    [Service]
    Environment=HTTP_PROXY=socks5://username:password@ip:port
    Environment=NO_PROXY=127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
    systemctl daemon-reload && systemctl restart docker
    

    now, you can smoothly install kubernetes in china.

  3. yum

    edit /etc/yum.conf, like this:

    vi /etc/yum.conf
    [main]
    proxy=socks5://ip:port
    proxy_username=user
    proxy_password=password